
package ro.imc.rest.client.callbacks;

import ro.imc.rest.client.display.util.DialogForm;
import ro.imc.rest.client.display.util.MessageConstants;

import com.google.gwt.user.client.rpc.AsyncCallback;

public abstract class AbstractCallBack implements AsyncCallback<String> {

	@Override
	public void onFailure(Throwable caught) {
		DialogForm.displayDialog(
			MessageConstants.REST_ERR_TITLE, caught.getMessage(),
			MessageConstants.REST_ERR_MESSAGE, MessageConstants.REST_ERR_TIP);

	}

	@Override
	public void onSuccess(String result) {
		if (result == null) {
			return;
		}
		processResponse(result);
	}

	protected abstract void processResponse(String response);

}
